<?php

	/**
	* @author Robbie Vasquez
 	* @author Matt Kennedy 
 	*/
	
	class Delete extends Model
	{
		//creating variables
		var $runID = '';
		
		//creating function to delete
		public function Delete()
		{
			// Call the model constructor
			parent::Model();
			
			$this->load->database();
					
		}
		
		//function causing a run to be deleted
		public function run()
		{
			mysql_connect('2006.ispace.ci.fsu.edu', 'rmv06d', 'zqgvht2m');
			mysql_select_db('runningrecords');
			
			$sql = "UPDATE runs SET isDeleted=1 WHERE username='" . $_SESSION['username'] . "' AND runID='" . $_POST['runID'] . "'";
			$result = mysql_query($sql) or die(mysql_error());
			
			//forwarding user to another page
			header("Location: /runningrecords/index.php/listing/list_runs");
			
		}
		
		//function causing a route to be deleted
		public function route()
		{
			
			mysql_connect('2006.ispace.ci.fsu.edu', 'rmv06d', 'zqgvht2m');
			mysql_select_db('runningrecords');
			
			$sql = "UPDATE routes SET isDeleted=1 WHERE username='" . $_SESSION['username'] . "' AND routeID='" . $_POST['routeID'] . "'";
			$result = mysql_query($sql) or die(mysql_error());
			
			header("Location: /runningrecords/index.php/listing/listroutes");
			
		}
		
	}	

/* EOF */